import { contentModel } from "../../model";

type TParams = {[x: string]: string | number | string[]}
const create = (params: TParams) => contentModel.create({
  ...params,
  create_time: new Date(),
  update_time: new Date(),
});
const update = (params: TParams) => contentModel.update(params, {
  where: {
    id: params.id,
  },
});
const findOne = (params: TParams) => contentModel.findOne({where:params});
const findByPk = (id: number | string) => contentModel.findByPk(id);

export default {
  create,
  update,
  findOne,
  findByPk,
}
